package com.dayuanit.dy17.atm.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@Controller
public class PageController {

    @RequestMapping(value = {"/", "/user/toLogin"})
    public String toLogin() {
        return "login";
    }

    @RequestMapping(value = "/user/toRegister")
    public String toRegister() {
        return "sign-up";
    }

    @RequestMapping(value = "/user/toHome")
    public String toHome() {
        return "index";
    }

    @RequestMapping("/user/toOpenAccount")
    public String toOpenAccount() {
        return "openaccount";
    }

    @RequestMapping("/user/toDeposit")
    public String toDeposit() {
        return "deposit";
    }

    @RequestMapping("/user/toTransfer")
    public String toTransfer() {
        return "transfer";
    }

    @RequestMapping("/user/toFlow")
    public String toFlow() {
        return "flow";
    }

    @RequestMapping(value = "/user/toBindEmail")
    public String toBindEmail() {
        return "bindEmail";
    }

    @RequestMapping("/user/toForgetPassword")
    public String toForgetPassword() {
        return "forgetPassword";
    }

    @RequestMapping("/user/toResetPassword")
    public String toResetPassword(String bindEmail, String sign, long createTime, HttpSession session) {
        System.out.println("---bindEmail=" + bindEmail + " sign=" + sign);

        session.setAttribute("bindEmail", bindEmail);
        session.setAttribute("bindEmailSign", sign);
        session.setAttribute("createTime", createTime);
        return "resetPwd";
    }

    @RequestMapping("/wx/toWxBind")
    public String toWxBind() {
        return "wxBind";
    }

    @RequestMapping("/user/toRecharge")
    public ModelAndView toRecharge(HttpServletRequest request) {
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("recharge");
        modelAndView.addObject("amount", "1000");
        return modelAndView;
    }


}
